export default {
    data() {
        return {
            list: [
                {
                    "name":"老王",
                    "img":"img/duanmofeng.jpg",
                    "des":"出来打篮球",
                    "time":"下午2:57"
                },
                {
                    "name":"小熊",
                    "img":"img/liuwei.jpg",
                    "des":"出来玩",
                    "time":"昨天"
                },
                {
                    "name":"马腾",
                    "img":"img/yanzhicheng.jpg",
                    "des":"出来狼人杀",
                    "time":"上午9:30"
                },
                {
                    "name":"陈明",
                    "img":"img/chenjiahui.jpg",
                    "des":"陈老师",
                    "time":"周五"
                }
            ]
        }
    },
    template: `
    <div>
        <div class="chats" @click="toDialog(item.name)" v-for="item in list">
            <div class="chats-left">
                <img :src="item.img" alt="">
            </div>
            <div class="chats-right">
                <div class="chats-right-msg">
                    <h3>{{item.name}}</h3>
                    <p>{{item.des}}</p>
                </div>
                <div class="chats-right-time">
                    <p>{{item.time}}</p>
                </div>
            </div>
        </div>
    </div>
    `,
    methods: {
        toDialog(name) {
            this.$router.push({
                path: "dialogue",
                query: {
                    id:name
                }
            })
            console.log(this.$router);

        }
    },
    }
 